Objectives

Field sampling

Two distinct locations are being monitored with different historical land-use and management in the province of Aragón (Spain): Ejea de los Caballeros (42º 01’ 06” N, 1º 08’ 53” W) at 350m above sea level with a total of 21 plots and Cantavieja (40º 30’ 44”, N 0º 22’ 59” W) at 1450m with a total of 30 plots. Plot size is 2m by 2m and they are distributed randomly within each location (see Figure x).

Figure 1.

Figure 1.

Figure 1.

Figure 1.

Data preparation

#Data processing and preparation for visualization and analysis

#First,load libraries
library(dplyr)
library(reshape2)
library(bipartite)

#Read data
data <- read.csv("life_polinizadores.csv")

#check structure of the data
#str(data)

#create separate datasets for the two different locations
ejea <- data %>% filter(site_id=="ejea caballeros")
canta <- data %>% filter(site_id=="cantavieja")

#select for now plant and pollinator species to create plant-pollinator networks from transects
ejea_species <- ejea %>% select(c("plants", "pollinators"))
canta_species <- canta %>% select(c("plants", "pollinators"))

#Now aggregate pollinator visits per plant species
ejea_aggreagted <-  ejea_species %>% count(plants, pollinators, sort = TRUE)
canta_aggreagted <- canta_species %>% count(plants, pollinators, sort = TRUE)

#Now convert to a matrix with the help of acast function from reshape library
ejea_matrix <- acast(ejea_aggreagted, plants~pollinators, value.var="n")
canta_matrix <- acast(canta_aggreagted, plants~pollinators, value.var="n")

#Convert NA's to zeros
ejea_matrix[is.na(ejea_matrix)] <- 0
canta_matrix[is.na(canta_matrix)] <- 0

Data visualization

Location 1 ‘Ejea caballeros’

#Set species names in italic
par(font = 3)

#Plot location 1
plotweb(sortweb(ejea_matrix, sort.order="dec"), method="normal", text.rot=90, 
col.low = "darkolivegreen1", col.high = "darkorange",
col.interaction="gray75",bor.col.interaction ="NA", labsize =.5)

Location 2 ‘Cantavieja’

#Plot location 2
plotweb(sortweb(canta_matrix, sort.order="dec"), method="normal", text.rot=90, col.low = "darkolivegreen1", col.high = "darkorange",col.interaction="gray75",
bor.col.interaction ="NA", labsize =.5)

Analysis of network structure

  1. Analizar y visualizar de forma reproducible las dos parcelas siguiendo, por ejemplo, estos codigos: https://ibartomeus.github.io/hab-sp_ntw/demo.html (Jose y Nacho)